package containers;

import java.util.Iterator;
import java.util.TreeMap;

public class SortedMapDemo {
    public static void main(String[] args){
        TreeMap<Integer,String> sortedMap = new TreeMap<Integer, String>(new CountingMapData(10));
        System.out.println(sortedMap);
        Integer low = sortedMap.firstKey();
        Integer height = sortedMap.lastKey();
        System.out.println(low);
        System.out.println(height);
        Iterator<Integer> ite = sortedMap.keySet().iterator();
        for (int i = 0 ;i <= 6;i ++){
            if (i == 3) low = ite.next();
            if (i == 6) height = ite.next();
            else ite.next();
        }
        System.out.println(low);
        System.out.println(height);
        System.out.println(sortedMap.subMap(low,height));
        System.out.println(sortedMap.tailMap(low));
        System.out.println(sortedMap.headMap(height));
    }
}
